#!/usr/bin/env python
from wwpy.net.Node import Node

def get_nodes():
    nodes=[]
    nodes.append(Node(host='10.5.20.15',port=58585,name='master',type='M'))
    nodes.append(Node(host='10.5.20.15',port=10101,name='worker0',type='W'))
    #nodes.append(Node(host='10.5.20.16',port=10101,name='worker1',type='W'))
    #nodes.append(Node(host='10.5.20.17',port=10101,name='worker2',type='W'))
    return nodes
    
nodes=get_nodes()

def diff_nodes():
    master_node=None
    worker_nodes=[]
    local_node=None
    remote_nodes=[]
    for node in nodes:
        if node.type=='M':
            master_node=node
        elif node.type=='W':
            worker_nodes.append(node)
        if node.is_local:
            local_node=node
        else:
            remote_nodes.append(node)
    return master_node,worker_nodes,local_node,remote_nodes

master_node,worker_nodes,local_node,remote_nodes=diff_nodes()